From d046c2261f88fd7dd5eb274f2847eb66f0dae1c9 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 19 Mar 2009 10:04:15 +0000 Subject: [PATCH] x86 dom builder: Allocate domU pages in batches. Allows a 32-bit dom0 to create very large guests. Signed-off-by: Mukesh Rathor Signed-off-by: Keir Fraser --- tools/libxc/xc_dom_x86.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/libxc/xc_dom_x86.c b/tools/libxc/xc_dom_x86.c index 9306636ba8..6ae9487656 100644 --- a/tools/libxc/xc_dom_x86.c +++ b/tools/libxc/xc_dom_x86.c @@ -694,7 +694,7 @@ static int x86_shadow(int xc, domid_t domid) int arch_setup_meminit(struct xc_dom_image *dom) { int rc; - xen_pfn_t pfn; + xen_pfn_t pfn, allocsz, i; rc = x86_compat(dom->guest_xc, dom->guest_domid, dom->guest_type); if ( rc ) @@ -713,9 +713,15 @@ int arch_setup_meminit(struct xc_dom_image *dom) dom->p2m_host[pfn] = pfn; /* allocate guest memory */ - rc = xc_domain_memory_populate_physmap(dom->guest_xc, dom->guest_domid, - dom->total_pages, 0, 0, - dom->p2m_host); + for ( i = rc = allocsz = 0; (i < dom->total_pages) && !rc; i += allocsz ) + { + allocsz = dom->total_pages - i; + if ( allocsz > 1024*1024 ) + allocsz = 1024*1024; + rc = xc_domain_memory_populate_physmap( + dom->guest_xc, dom->guest_domid, allocsz, 0, 0, &dom->p2m_host[i]); + } + return rc; } -- 2.30.2